<?
// Skin Block:  Admin Link
// Displays an admin section link if there is a valid admin session.
// Created By:  Matt ( http://xtrafile.com )
global $language, $siteurl;
$skin_parse = '';
$sql = "SELECT * FROM lang";
$qr1 = $db->query($sql);

$skin_parse .= "<div id='langSel' style='left:550px; width:200px;' onmouseover='langDown(this)' onmouseout='langUp(this)'>";

$currLang = $_GET['langSwitch'];

$skin_parse .= "<center><table width='100%' height='auto' cellpadding='0' cellspacing='0' border='0' id='langForm'><tr height='22px'>";
$i = 0;
$a = 0;
while($a = $db->fetch($qr1))
{
	if($i % 8 == 0 && $i != 0)
	{
		$skin_parse .= '</tr><tr height="22px">';
		$a++;
	}
	$skin_parse .= "<td valign='middle'>
	<center>
		<a class='langBtn' href='".makeXuLink('index.php', str_replace(array('langSwitch='.$currLang,'&langSwitch='.$currLang),'',$_SERVER['QUERY_STRING'])."&langSwitch=".str_replace(array('.php'),'',$a->file))."'>
			<img border='0' src='".$siteurl."images/flags/".strtolower($a->cc).".png' alt='".$a->name."' />
		</a>
	<center></td>";
	$i++;
}
//<hr noshade='noshade' />
$skin_parse .= "</tr></table>Language</center></div>
<script>
$(document).ready(function(){
	$('#langSel').css('top', '-".((($a+1)*22)+30)."');
});
function langDown(div)
{
	$(div).css(\"top\",\"0px\");
}

function langUp(div)
{
	$(div).css(\"top\",\"-".((($a)*22)+30)."px\");
}
</script>";	  
?>